# -*- coding: utf-8 -*-
import httpx


client = httpx.Client(base_url = "http://127.0.0.1:80/")

# Попытка регистрации без параметров
request = client.post("/registration")
print(request) # <Response [400 Bad Request]>

# Удачный пример регистрации с использованием JSON
request = client.post("/registration",
    json = {
        "email":     "valid@email.ru",
        "password":  "PAssw0rd",
        "firstName": "Вадим",
        "lastName":  "Кузнецов"
    })

print(request)         # <Response [201 Created]>
print(request.content) # b'{"id":1,"email":"valid@email.ru","firstName":"\xd0\x92\xd0\xb0\xd0\xb4\xd0\xb8\xd0\xbc","lastName":"\xd0\x9a\xd1\x83\xd0\xb7\xd0\xbd\xd0\xb5\xd1\x86\xd0\xbe\xd0\xb2"}'


# Удачный пример регистрации с использованием Data (эквивалент Body, не стабильный)
request = client.post("/registration",
    data = {
        "email":     "mail@mail.ru",
        "password":  "itsMyPassw0rd",
        "firstName": "Олег",
        "lastName":  "Тришкин"
    })

print(request)         # <Response [201 Created]>
print(request.content) # b'{"id":2,"email":"mail@mail.ru","firstName":"\xd0\x9e\xd0\xbb\xd0\xb5\xd0\xb3","lastName":"\xd0\xa2\xd1\x80\xd0\xb8\xd1\x88\xd0\xba\xd0\xb8\xd0\xbd"}'